package com.common;

import java.util.List;

/**
 * 作者: 谢韬元
 * 日期: 2024/12/16
 * 类名: PageUtils
 */
    public class PageUtils<T> {

        private int pageIndex;

        private int pageSize;

        private int total;

        private int totalPage;

        private List<T> records;


        public int getPageIndex() {
            return pageIndex;
        }

        public void setPageIndex(int pageIndex) {
            this.pageIndex = pageIndex;
        }

        public int getPageSize() {
            return pageSize;
        }

        public void setPageSize(int pageSize) {
            this.pageSize = pageSize;
        }

        public int getTotal() {
            return total;
        }

        public void setTotal(int total) {
            this.total = total;
        }

        public int getTotalPage() {
            totalPage = total % pageSize == 0 ? total / pageSize : (total / pageSize) + 1;

            return totalPage;
        }

        public void setTotalPage(int totalPage) {
            this.totalPage = totalPage;
        }

        public List<T> getRecords() {
            return records;
        }

        public void setRecords(List<T> records) {
            this.records = records;
        }
}
